package cn.bone.web.test.component;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.stereotype.Component;

@Component
public class SnowflakeFactory {

    private long workerId = 0;
    private long datacenterId = 0;
    private Snowflake snowflake = IdUtil.getSnowflake(workerId,datacenterId);

    public long getId(){
        return snowflake.nextId();
    }

    public String getStrId(){
        return snowflake.nextIdStr();
    }
}
